#define  _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
class Solution {
public:
    bool zimu(char ch) {
        if (ch >= 'a' && ch <= 'z') {
            return true;
        }
        else if (ch >= 'A' && ch <= 'Z') {
            return true;
        }
        else {
            return false;
        }
    }
    string reverseOnlyLetters(string s) {
        if (s.empty()) {
            return s;
        }
        int begin = 0;
        int end = s.size() - 1;
        while (begin < end) {
            while (begin < end && zimu(s[begin]) == false) {
                ++begin;
            }
            while (begin < end && zimu(s[end]) == false) {
                --end;
            }
            swap(s[begin], s[end]);
            begin++;
            end--;
        }
        return s;
    }
};

class Solution {
public:
    int firstUniqChar(string s)
    {
        for (int i = 0; i < s.size(); ++i)
        {
            int index = s.find(s[i]);
            int reverse_index = s.rfind(s[i]);
            if (index == reverse_index)
                return i;
        }
        return -1;
    }
};